package com.dotstone.chipism.activity;

import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.dotstone.chipism.R;
import com.dotstone.chipism.util.ToastShow;
import com.dotstone.chipism.view.slidingfragmenu.BarUtils;

public class FeedbackActivity extends BaseActivity {
	private LinearLayout mBackL;
	private TextView mStatusBar;
	private TextView mTitleTv;
	private Button btnAdd;
	private Button submit_btn;
	private EditText phone_ed;
	private EditText feedback_ed;


	@Override
	public void widgetClick(View v) {
		switch (v.getId()) {
			case R.id.back_layout:
				finish();
				break;
			case R.id.submit_btn:
			      if(TextUtils.isEmpty(feedback_ed.getText().toString())){
					  ToastShow.Show(getApplicationContext(), "请输入反馈内容！");
			      }else{
					  ToastShow.Show(getApplicationContext(), "提交成功");
					  finish();
				  }

				break;
		}

	}

	@Override
	public void initParms(Bundle parms) {
		// TODO Auto-generated method stub

	}

	@Override
	public View bindView() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int bindLayout() {
		// TODO Auto-generated method stub
		return   R.layout.activity_feedback;
	}

	@Override
	public void initView(View view) {
		mBackL = $(R.id.back_layout);
		mStatusBar = $(R.id.tv_statusBar_mian);
		mTitleTv = $(R.id.title_tv);
		btnAdd = $(R.id.nextstep);
		submit_btn = $(R.id.submit_btn);
		phone_ed = $(R.id.phone_ed);
		feedback_ed = $(R.id.feedback_ed);
		mTitleTv.setVisibility(View.VISIBLE);
		mTitleTv.setText("用户反馈");
		btnAdd.setVisibility(View.INVISIBLE);
		boolVersion();

	}

	@Override
	public void setListener() {
		mBackL.setOnClickListener(this);
		submit_btn.setOnClickListener(this);

	}

	@Override
	public void doBusiness(Context mContext) {
		// TODO Auto-generated method stub

	}

	public void boolVersion() {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

			Window window = getWindow();
			window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
					WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
			// 透明导航栏
			// getWindow().addFlags(
			// WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
			// 改变titlebar的高度
			int statusbarHeight = BarUtils.getStatusBarHeight(this);
			RelativeLayout.LayoutParams layoutParams1 = (RelativeLayout.LayoutParams) mStatusBar.getLayoutParams();
			layoutParams1.height = statusbarHeight;
			mStatusBar.setLayoutParams(layoutParams1);
			mStatusBar.setVisibility(View.VISIBLE);
		} else {
			mStatusBar.setVisibility(View.GONE);
		}
	}
}
